Skip to content

Modernize codebase with pyupgrade for Python 3.8+ - #17

Closed
csett86 with Copilot wants to merge 5 commits into
mainfrom
copilot/run-pyupgrade-to-modernize
Closed

csett86 with Copilot wants to merge 5 commits into
mainfrom
copilot/run-pyupgrade-to-modernize

Conversation

Copilot AI commented Jan 17, 2026 •

Copy link
Copy Markdown

Ran pyupgrade --py38-plus across the codebase to modernize Python syntax for the minimum supported version (3.8+).

Changes

  • String formatting: Converted .format() and % formatting to f-strings

    # Before
    body = '{0}({1})'.format(jsonp, body)
    errors['tz'] = "Unknown timezone: '{0}'.".format(tz)
    response.write("%s,%d,%d,%d|" % (series.name, series.start, series.end, series.step))
    
    # After
    body = f'{jsonp}({body})'
    errors['tz'] = f"Unknown timezone: '{tz}'."
    response.write(f"{series.name},{series.start},{series.end},{series.step}|")
  • Unicode prefixes: Removed u'' string prefixes (Python 3 default)

  • Encoding headers: Removed # coding: utf-8 declarations (Python 3 default)

  • Import compatibility: Removed Python 2/3 fallback for unittest.mock

    # Before
    try:
        from unittest.mock import patch
    except ImportError:
        from unittest.mock import patch
    
    # After
    from unittest.mock import patch

28 files changed: 151 insertions(+), 170 deletions(-)

Original prompt

Run pyupgrade to modernize codebase based on python3.8 as oldest supported version


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 17, 2026 11:58
Co-authored-by: csett86 <1392875+csett86@users.noreply.github.com>
Co-authored-by: csett86 <1392875+csett86@users.noreply.github.com>
Co-authored-by: csett86 <1392875+csett86@users.noreply.github.com>
Co-authored-by: csett86 <1392875+csett86@users.noreply.github.com>
Copilot AI changed the title [WIP] Run pyupgrade to modernize codebase for Python 3.8 Modernize codebase with pyupgrade for Python 3.8+ Jan 17, 2026
Copilot AI requested a review from csett86 January 17, 2026 12:07
@csett86
csett86 marked this pull request as ready for review January 17, 2026 12:07
@csett86 csett86 closed this Jan 17, 2026
@csett86
csett86 deleted the copilot/run-pyupgrade-to-modernize branch January 17, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants